import os
import platform
import yaml
from website.util.logger import log

# 读取根目录下的配置文件
cur_path = os.path.abspath(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
# windows 系统认为是开发环境，读取 dev 配置
if platform.system().lower() == 'windows':
    log().info("读取测试环境配置")
    with open(cur_path+'/config-dev.yaml', 'r', encoding='utf-8') as file:
        config = yaml.load(file.read(), Loader=yaml.FullLoader)
# linux 系统认为是生产环境，读取 prod 配置
elif platform.system().lower() == 'linux':
    log().info("读取生产环境配置")
    with open(cur_path+'/config-prod.yaml', 'r', encoding='utf-8') as file:
        config = yaml.load(file.read(), Loader=yaml.FullLoader)
